Undirected path(s) between two nodes:
Undirected path(s) between two nodes
Description
Undirected path(s) between two nodes.
Usage
undir.path(G, y, x)
Arguments
G
An adjacency matrix where G[i,j] = G[j, i] = 1 means there is an edge between nodes i and j. If G[i, j] = G[j, i] = 0 there is no edge between them.
y
A numerical value indicating the first node, it has to be a number between 1 and the maximum number of variables.
x
A numerical value indicating the second node, it has to be a number between 1 and the maximum number of variables. The order of the nodes does not make a difference.
Value
A vector with the two nodes and all nodes between them in the case of connecting nodes. Otherwise, a matrix with the neighbours of each node.
Details
The algorithm finds all the nodes between the tow nodes. It finds all paths between the two chosen nodes.
References
Tsamardinos, Brown and Aliferis (2006). The max-min hill-climbing Bayesian network structure learning algorithm. Machine learning, 65(1), 31-78.